function enterTextBox(textBox)
{
    textBox.style.borderStyle= 'inset';
    textBox.style.borderWidth= '2px';
    textBox.style.borderColor= 'red';
    textBox.style.background = '#FFCC66';

}

function leaveTextBox(textBox)
{

    textBox.style.borderStyle= 'inset';
    textBox.style.borderWidth= '2px';
    textBox.style.borderColor= '#999999';
    textBox.style.background = '#FFFFFF';

}

function resizePage()
{
    document.getElementById('menuCell').height= document.getElementById('innerPageCell').offsetHeight+'px';
}


function buttonOver(button)
{
    button.style.cursor='pointer';
    button.style.color='black';
    button.style.backgroundColor= 'white'
}

function buttonOutLogin(button)
{
    button.style.color='#175694';
}

function buttonOverLogin(button)
{
    button.style.cursor='pointer';
    button.style.color='black';
}

function buttonOut(button)
{
    button.style.color='#175694';
    button.style.backgroundColor= 'white'
}

function clearSearch(textbox)
{
    if((textbox.value=='Search'))
    {
        textbox.value='';
        textbox.style.color='black';
    }
    else
    {
        textbox.style.color='black';
    }
}

function fillSearch(textbox)
{
    if(textbox.value=='')
    {
        textbox.value='Search';
        textbox.style.color='#666666';
    }
}

function validateSearch()
{
    var textBox=document.getElementById('searchTextBox');
    if((textBox.value=='Search')||(textBox.value=='Search')||(textBox.value==""))
    {
        alert("Please enter keyword in search box");
        return false;
    }
    else
    {
        return true;
    }
}

// BI Pages
// CPM Page
function cpmPage()
{
    document.getElementById("innerPageCell").innerHTML=
    "<table>"+
"<tr><td class='title'>Corporate Performance Management Overview</td></tr>"+
"<tr><td >"+
"<p>The definition of corporate performance management (CPM) has remained consistent since industry analysts Gartner Research introduced CPM in 2001.</p>"+
"<p>CPM is an umbrella term that describes all of the processes, methodologies, metrics and systems needed to measure and manage the performance of an organization.Gartner Research, Magic Quadrants for CMP Suites:No Dramatic Movement in 2004.</p><br/>"+
"<p>Despite this stability in definition, CPM as a practice has evolved greatly since 2001.Many companies from the Global 3500 and major public sector "+
"organizations have embraced the vision of CPM. They understand the value of enabling and engaging everyone in an organization "+
"to manage the organization's performance. They are deploying technologies and solutions to make that vision real.</p>"+
"<p>These organizations understand how CPM can help them answer "+
"their fundamental business questions:<br/><br/>"+
"<p><ul>"+
"<li><p><b>How are we doing? </b></p></li>"+
"<li><p><b>Why? </b></p></li>"+
"<li><p><b>What should we be doing? </b></p></li></ul><br/>"+
"<p><a href='#Scorecard' onclick='scoreCardPage()' ><u>Scorecarding and Dashboards</u></a>, <a href='#BI' onclick='biPage()'><u>"+
"Business Intelligence</u></a>, and <a href='#Planning' onclick='planningPage()' ><u>"+
"Planning and Consolidation</u></a> technologies answer these "+
"questions. The questions connect; CPM requires they not be stand-alone elements. Knowing what happened, without finding out "+
"why, is of little use to the business. Knowing why something happened, but being unable to plan and make the necessary changes is likewise of limited value.</p>"+
"</td></tr>"+
"</table>";
}

// VBM Page
function vbmPage()
{
    document.getElementById("innerPageCell").innerHTML=
    "<table>"+
"<tr><td class='title'>What is Value Based Management (VBM)?</td></tr>"+
"<tr><td><b>Definition 1:</b>Value Based Management is the management approach that ensures corporations are run consistently on value&nbsp;(normally: maximizing shareholder value).<br><br>It is useful to understand that Value Based Management includes all three of the following:<br>"+
"<ul><li><p>Creating Values (ways to actually increase or generate maximum future value <b>?strategy</b>).</p></li>"+
"<li><p>Managing for Value (governance, change management,organizational culture, communication, leadership).</p></li>"+
"<li><p>Measuring Value (valuation).</p></li></ul>"+
"<tr><td><br><b>Definition 2:</b> Value Based Management aims to provide consistency of:"+
"<ul><li><p>The corporate mission (business philosophy).</p></li>"+
"<li><p>The corporate strategy (courses of action to achieve corporate mission and purpose).</p></li>"+
"<li><p>Corporate governance (who determines the corporate mission and regulates the activities of the corporation).</p></li>"+
"<li><p>The corporate culture.</p></li>"+
"<li><p>Corporate communication.  </p></li>"+
"<li><p>Organization of the corporation.  </p></li>"+
"<li><p>Decision processes and systems.  </p></li>"+
"<li><p>Performance management processes and systems.  </p></li>"+
"<li><p>Reward processes and systems</p></li></ul>";
}

// EVA Page
function evaPage()
{
    document.getElementById("innerPageCell").innerHTML=
    "<table>"+
"<tr><td class='title'>What is Economic Value Added (EVA)?</td></tr>"+
"<tr><td><b>Economic Value Added</b>is the financial performance measure that comes closer than any other to capturing the true economic profit of an enterprise. "+
"<tr><td><p><br><b>EVA</b>® also is the performance measure most directly linked to the creation of shareholder wealth over time. Stern Stewart & Co. guides client companies through the implementation of a complete EVA-based financial management and incentive compensation system that gives managers superior information - and superior motivation - to make decisions that will create the greatest shareholder wealth in any publicly owned or private enterprise.";
}

// TQM Page
function tqmPage()
{
    document.getElementById("innerPageCell").innerHTML=
    "<table>"+
"<tr><td class='title'>What is Total Quality Management (TQM)?</td></tr>"+
"<tr><td><b>Total Quality Management (TQM)</b> is a comprehensive and structured approach to organizational management that seeks to improve the quality of products and services through ongoing refinements in response to continuous feedback. TQM requirements may be defined separately for a particular organization or may be in adherence to established standards, such as the International Organization for Standardization's ISO 9000 series."+
"<tr><td><br><b>TQM </b> can be applied to any type of organization; it originated in the manufacturing sector and has since been adapted for use in almost every type of organization imaginable, including schools, highway maintenance, hotel management, and churches. As a current focus of e-business, TQM is based on quality management from the customer's point of view. ";

}

// Scorecard Page
function scoreCardPage()
{
    document.getElementById("innerPageCell").innerHTML=
    "<table>"+
"<tr><td class='title'>Scorecarding and Dashboard Software</td></tr>"+
"<tr><td><p><b>Scorecards </b>enhance conventional reporting by including user-set targets. You can set targets for operational priorities in your own department and monitor your progress. You can also use targets to manage objectives and execute on the larger strategy with approaches such as the Balanced Scorecard.<br/><br/></p>"+
"<tr><td><a href='#CMM' onclick='metricManagerPage()'>Cognos Metric Manager (CMM) Example</a><br/><br/>"+
"<tr><td><p>See at-a-glance how you are doing now and as a trend against your targets. Drill-through to reports and data for detail about the scorecard metric to understand the \"why\" behind it.</p><br/>"+
"<tr><td><p><b>Dashboards  </b>also communicate complex information quickly. They translate your corporate data into a rich, graphical presentation using gauges, maps, charts, and other graphics to show multiple results together. Dynamic dashboards also let you drill-through to other data sources and reports for more detail about what the dashboard shows you. <br/><br/></p>"+
"<tr><td><a href='#CRN' onclick='reportNetPage()'>Cognos ReportNet (CRN) Example</a>";

}

// Metric Manager Image Page
function metricManagerPage()
{
    document.getElementById("innerPageCell").innerHTML=
    "<table>"+
"<tr><td class='title'><img src='Images/cmm_key_features.jpg' width='1000' height='670'></td></tr></table>";
}

// Report Net Image Page
function reportNetPage()
{
    document.getElementById("innerPageCell").innerHTML=
    "<table>"+
"<tr><td class='title'><img src='Images/crn.jpg' width='1000' height='670'></td></tr></table>";
}

// BI Page
function biPage()
{
    document.getElementById("innerPageCell").innerHTML=
    "<table>"+
"<tr><td class='title'>Business Intelligence</td></tr>"+
"<tr><td><p>Better visibility for the best business decisions."+
"Cognos business intelligence software improves your performance as the folowing :<br><br></p>"+
"<tr><td><ul>"+
"<li><p><b>Leverage your existing data investment</b>&mdash;BI takes the volume of data your organization collects and stores, and turns it into meaningful reports and analysis that everyone can use.</p></li><br>"+
"<li><p><b>A complete line of sight</b>&mdash;with accessible reports and analysis, you can see results across departments and drill down to discover underlying causes and understand the \"Why\" behind your business performance.</p></li><br>"+
"<li><p><b>Align everyone with one, reliable version of the truth</b>&mdash;with common data definitions and understanding of priorities, you will spend less time debating the data and more time deciding what to do.</p></li><br>"+
"<li><p><b>Shorten the time to make the right decision</b>&mdash;with timely reports and self-service reporting on your key business drivers, you see changes when they happen and make the right decisions at the right time.</p></li><br>"+
"<li><p><b>Meet the information needs of all users</b>&mdash;flexible, user-friendly reporting means everyone can have the right information delivered in the right way: whether managed reports, dashboards, scorecards, online analysis, or self-service reporting and queries.</p></li><br></ul>";

}

// Planning Page
function planningPage()
{
    document.getElementById("innerPageCell").innerHTML=
    "<table>"+
"<tr><td class='title'>Planning and Consolidation</td></tr>"+
"<tr><td>- Cognos planning and consolidation software improves your performance by : <br><br>"+
"<tr><td><ul>"+
"<li><p><b>Plan and budget in real-time</b>with dynamic plans that provide real-time feedback to everyone who is part of the process.</p></li><br>"+
"<li><p><b>Secure a single, accurate view of key information</b>by consolidating multiple diverse ledgers into a single, common chart-of-accounts structure.</p></li><br>"+
"<li><p><b>Make adjustments as necessary</b> with flexible plans and rolling forecasts that let you realign as events occur rather than annual budgets that are out of date as soon as they're printed.</p></li><br>"+
"<li><p><b>Engage all necessary participants</b> with inclusive plans that improve buy-in, rather than the pain of multiple, unlinked spreadsheets.</p></li><br>"+
"<li><p><b>Communicate plans enterprise-wide</b> and with external partners as necessary to keep everyone on the same page.</p></li><br></ul></td></tr>"+
"<tr><td>- Cognos offers the complete range of software to let you create plans, forecasts and budgets, and consolidate and report on finances as the following :<br><br></td></tr>"+
"<tr><td><ul>"+
"<li><p><b>Create plans and budgets — Cognos® Planning :</b> Build consistent, interconnected business models. Access current data to assess fiscal performance. Proceed from the \"what-is\" to evaluate the \"what-if\" scenarios critical for future success. Extend the planning solution outside Finance so those who see changing business conditions first in the operations of the enterprise are engaged and connected. Ensure the best view of enterprise performance.</p></li><br>"+
"<li><p><b>Consolidate and report financials — Cognos® Controller :</b> Secure a single, accurate, corporate view of key information. Reduce consolidation, close, and reporting cycles by days or weeks. Support better planning and forecasting with a single version of financial fact.</p></li><br></ul></td></tr>";


}
/////////////////////////////////////////////////////////////////////////////////////////////

function nationalityChanged1()
{
    if(document.all)     //Internt Explorer
    {
        var combo =document.all.Update_application.elements["Nationality"];
        var combo1 =document.all.Update_application.elements["Gender"];
        if(combo.options[combo.selectedIndex].value=='Egypt')
        {
            document.all.ssn.style.visibility = 'visible';
            document.all.national_idcell.style.visibility = 'visible';
        }
        else
        {
            document.all.ssn.style.visibility = 'hidden';
            document.all.national_idcell.style.visibility = 'hidden';
        }
        if(combo.options[combo.selectedIndex].value=='Egypt' && combo1.options[combo1.selectedIndex].value=='Male')
        {
            document.all.military.style.visibility = "visible";
            document.all.malitaryCell.style.visibility = 'visible';
        }
        else
        {
            document.all.military.style.visibility= "hidden";
            document.all.malitaryCell.style.visibility = 'hidden';
        }

    }
    else
    if(document.getElementById)  // Firefox
    {
        var combo =document.Update_application.elements["Nationality"];
        var combo1 =document.Update_application.elements["Gender"];
        if(combo.options[combo.selectedIndex].value=='Egypt' )
        {
            document.getElementById('ssn').style.visibility = 'visible';
            document.getElementById('National_IdCell').style.visibility = 'visible';
        }
        else
        {
            document.getElementById('ssn').style.visibility = 'hidden';
            document.getElementById('National_IdCell').style.visibility = 'hidden';

        }

        if(combo.options[combo.selectedIndex].value=='Egypt' && combo1.options[combo1.selectedIndex].value=='Male')
        {
            document.getElementById('malitaryCombo').style.visibility = 'visible';
            document.getElementById('malitaryCell').style.visibility = 'visible';
        }
        else
        {
            document.getElementById('malitaryCombo').style.visibility = 'hidden';
            document.getElementById('malitaryCell').style.visibility = 'hidden';
        }
    }
}

function maritalChanged1()
{
    if(document.all) //Internt Explorer
    {
        var combo =document.all.Update_application.elements["marital"];
        if((combo.options[combo.selectedIndex].value!='Single')&&(combo.options[combo.selectedIndex].value!='-1'))
        {
            document.all.childrenCombo.style.visibility = 'visible';
            document.all.childrenCell.style.visibility = 'visible';
        }
        else
        {
            document.all.childrenCombo.style.visibility = 'hidden';
            document.all.childrenCell.style.visibility= 'hidden';
        }
    }

    else  //(document.getElementById)  Firefox
    {
        var combo =document.Update_application.elements["marital"];
        if((combo.options[combo.selectedIndex].value!='Single')&&(combo.options[combo.selectedIndex].value!='-1'))
        {
            document.getElementById('childrenCombo').style.visibility = 'visible';
            document.getElementById('childrenCell').style.visibility = 'visible';
        }
        else
        {
            document.getElementById('childrenCombo').style.visibility = 'hidden';
            document.getElementById('childrenCell').style.visibility = 'hidden';
        }
    }
}

function hideComponent()
{


    document.getElementById('childrenCombo').style.visibility = 'hidden';
    document.getElementById('childrenCell').style.visibility = 'hidden';
    document.getElementById('malitaryCombo').style.visibility = 'hidden';
    document.getElementById('malitaryCell').style.visibility = 'hidden';
}

function winBRopen(theURL, Name, popW, popH, scroll)
{ // V 1.0

    if(document.all)
    {
        popW=(parseInt(popW)-8);
        popH=(parseInt(popH));
    }

    var winleft = (screen.width - popW) / 2;
    var winUp = (screen.height - popH) / 2;
    winProp =
    'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scroll+','
    Win = window.open(theURL, Name, winProp)
    if (parseInt(navigator.appVersion) >= 4){
        Win.window.focus();
    }

}

function showDiv(refresh)
{
    document.getElementById("messageDiv").innerHTML=
    "<table border='2'>"+
"<tr>"+
"<th style=' height: 30px; width: 200px;' bgcolor='#175694'>"+
"<center><font color='white'><strong>EPROM  Notes</strong></font></center></th>"+
"</tr>"+
"<tr>"+
"<td style=' height: 30px; width: 200px;' class='message'>"+
"<center> <img src='Images/Apply.png'  width='70' height='70' alt='The New record has been inserted successfully '>  </center>"+
"</td>"+
"</tr>"+
"</table>"
}

function showMessage()
{
    if (document.getElementById)
    { // DOM3 = IE5, NS6
        document.getElementById('messageDiv').style.visibility = 'visible';
    }
    else
    {
        if (document.layers)
        { // Netscape 4
            document.messageDiv.visibility = 'visible';
        }
        else
        { // IE 4
            document.all.messageDiv.style.visibility = 'visible';
        }
    }
    showDiv("Update_project");
}

function hideMessage()
{
    if (document.getElementById)
    { // DOM3 = IE5, NS6
        document.getElementById('messageDiv').style.visibility = 'hidden';
    }
    else
    {
        if (document.layers)
        { // Netscape 4
            document.messageDiv.visibility = 'hidden';
        }
        else
        { // IE 4
            document.all.messageDiv.style.visibility = 'hidden';
        }
    }
}

function ValidateForm()
{
    var check_Email =document.f1.t1;
    var check_password =document.f1.t2;
    check_Email.value=check_Email.value.trim();
    check_password.value=check_password.value.trim();
    if (check_Email.value=="")
    {
        alert ( "Please Enter Your Email" );
        check_Email.focus();
        return false;
    }
    if (errorcheck(check_Email.value)==false)
    {
        alert("Invalid Character \" ");
        check_Email.focus();
        return false;
    }

    if (check_Email.value.length>100)
    {
        alert("Email is too long");
        check_Email.focus();
        return false;
    }

    if (echeck(check_Email.value)==false)
    {
        check_Email.focus();
        return false;
    }

    if (check_password.value=="")
    {
        alert ( "Please Enter Your Password" );
        check_password.focus();
        return false;
    }
    if (errorcheck(check_password.value)==false)
    {
        alert("Invalid Character \" ");
        check_password.focus();
        return false;
    }
    if (check_password.value.length<6)
    {
        alert("Password shouldn't be less than 6 characters ");
        check_password.focus();
        return false;
    }
    if (check_password.value.length>45)
    {
        alert("Password is too long ");
        check_password.focus();
        return false;
    }
    return true;
}

function validate_Level()
{
    var numbers=/^[0-9]+$/;
    var t1= document.Add_Level.level_name;
    var t2= document.Add_Level.level_rank;

    if(t1.value=="")
    {
        alert ( "Please enter level name" );
        t1.focus();
        return false;
    }
    if(t1.value.length>50)
    {
        alert ( "the name is too large" );
        t1.focus();
        return false;
    }
    if(t2.value=="")
    {
        alert ( "Please enter rank number" );
        t2.focus();
        return false;
    }
    if(!t2.value.match(numbers)||t2.value>1000)
    {
        alert ( "invalid level rank number " );
        t2.focus();
        return false;
    }
    return true;
}

function validate_News()
{
    var compo= document.Add_News.news_category;

    var news_title= document.Add_News.news_title;
    var news_date= document.Add_News.news_date;

    // var im= document.getElementById('logoName1').src;
    // var im1= document.getElementById('logoName2').src;
    var short_disc= document.Add_News.news_shortDiscription;

    if(compo.value=="Select news category")
    {
        alert ( "please select the news category" );
        return false;
    }
    if(news_title.value=="")
    {
        alert ( "Please enter valid title" );

        news_title.focus();
        return false;

    }
    if(news_date.value=="")
    {
        alert ( "Please enter Date" );

        news_date.focus();
        return false;

    }
    /*  if(im.match(""))
       {
                alert ( "Please upload logo" );
             return false;
          }
           if(im1.match(""))
       {
                alert ( "Please upload news image" );
             return false;
          }*/
    if(short_disc.value=="")
    {
        alert ( "Please enter a short discription" );

        short_disc.focus();
        return false;

    }
    return true;
}


function  validate_regestration()
{
    var check_name =document.register.name;
    var check_Email =document.register.email;
    var check_password =document.register.pass1;
    var check_confirmp =document.register.pass2;
    var check_Question =document.register.question;
    var check_answer =document.register.answer;
    var check_type =document.register.type;
    var alpha=/^[a-zA-Z]+$/;
    check_name.value=check_name.value.trim();
    check_Email.value=check_Email.value.trim();
    check_password.value=check_password.value.trim();
    check_confirmp.value=check_confirmp.value.trim();
    check_answer.value=check_answer.value.trim();

    if (check_name.value=="")
    {
        alert ( "Please Enter Your Name " );

        check_name.focus();
        return false;
    }


    if (!check_name.value.match(alpha))
    {
        alert ( "Please Enter Correct Name" );

        check_name.focus();
        return false;
    }
    if (errorcheck(check_name.value)==false)
    {
        alert("Invalid Character \" ");
        check_Email.focus();
        return false;
    }

    if (check_name.value.length>45)
    {
        alert("Name is too long");
        check_name.focus();
        return false;
    }

    if (check_Email.value=="")
    {
        alert ( "Please Enter Your Email" );
        check_Email.focus();
        return false;
    }
    if (errorcheck(check_Email.value)==false)
    {
        alert("Invalid Character \" ");
        check_Email.focus();
        return false;
    }

    if (check_Email.value.length>100)
    {
        alert("Email is too long");
        check_Email.focus();
        return false;
    }

    if (echeck(check_Email.value)==false)
    {
        check_Email.focus();
        return false;
    }

    if (check_password.value=="")
    {
        alert ( "Please Enter Your Password" );
        check_password.focus();
        return false;
    }
    if (errorcheck(check_password.value)==false)
    {
        alert("Invalid Character \" ");
        check_password.focus();
        return false;
    }
    if (check_password.value.length<6)
    {
        alert("Password shouldn't be less than 6 characters ");
        check_password.focus();
        return false;
    }
    if (check_password.value.length>45)
    {
        alert("Password is too long ");
        check_password.focus();
        return false;
    }


    if (check_confirmp.value=="")
    {
        alert ( "Please Enter Your Password Again" );
        check_confirmp.focus();
        return false;
    }
    if (errorcheck(check_confirmp.value)==false)
    {
        alert("Invalid Character \" ");
        check_confirmp.focus();
        return false;
    }
    if (check_confirmp.value.length<6)
    {
        alert("Password shouldn't be less than 6 characters ");
        check_confirmp.focus();
        return false;
    }
    if (check_confirmp.value.length>45)
    {
        alert("Password is too long ");
        check_confirmp.focus();
        return false;
    }

    if (check_password.value!=check_confirmp.value)
    {
        alert ( "Please Enter Your Password Correctly" );

        check_confirmp.focus();
        return false;
    }

    if (check_Question.value=="Please Select One")
    {
        alert ( "Please Choose a Question" );
        return false;
    }

    if (check_answer.value=="")
    {
        alert ( "Please Enter Answer " );

        check_answer.focus();
        return false;
    }

    if (errorcheck(check_answer.value)==false)
    {
        alert("Invalid Character \" ");
        check_answer.focus();
        return false;
    }

    if (check_answer.value.length>100)
    {
        alert("Answer is too long");
        check_answer.focus();
        return false;
    }


    if (check_type.value=="Please Select One")
    {
        alert ( "Please choose type" );
        return false;
    }



    return true;
}

function  validate_contactus()
{

    var check_name =document.contact.name;
    var check_phone =document.contact.phone;
    var check_Email=document.contact.email;
    var check_sup=document.contact.subject;
    var check_message =document.contact.message;
    var numbers=/^[0-9]+$/;

    check_name.value=check_name.value.trim()
    check_phone.value=check_phone.value.trim()
    check_Email.value=check_Email.value.trim()
    check_sup.value=check_sup.value.trim()
    check_message.value=check_message.value.trim()



    if (check_name.value=="")

    {

        alert ( "Please Enter Your Name" );

        check_name.focus();
        return false;
    }
    if (errorcheck(check_name.value)==false)
    {
        alert("Invalid Character \" ");
        check_name.focus();
        return false;
    }

    if(check_name.value.length>45)
    {
        alert ( "Name is too long" );

        check_name.focus();
        return false;

    }

    if (check_phone.value=="")
    {
        alert ( "Please Enter Your Telephone Number" );


        check_phone.focus();
        return false;
    }
    if(!check_phone.value.match(numbers))
    {
        alert ( "Invalid Telephone Number" );

        check_phone.focus();
        return false;
    }
    if(check_phone.value.length>20)
    {
        alert ("Telephone Number is too long" );
        check_phone.focus();
        return false;
    }

    if (check_Email.value=="")
    {
        alert ( "Please Enter Your Email" );
        check_Email.focus();
        return false;
    }
    if (errorcheck(check_Email.value)==false)
    {
        alert("Invalid Character \" ");
        check_Email.focus();
        return false;
    }


    if (echeck(check_Email.value)==false)
    {
        check_Email.focus();
        return false;
    }
    if (check_Email.value.length>100)
    {
        alert("Email is too long");
        check_Email.focus();
        return false;
    }


    if(check_sup.value=="")
    {
        alert ( "Please Enter Message Subject " );

        check_sup.focus();
        return false;

    }
    if (errorcheck(check_sup.value)==false)
    {
        alert("Invalid Character \" ");
        check_sup.focus();
        return false;
    }
    if(check_sup.value.length>100)
    {
        alert ( "Subject is too long" );

        check_sup.focus();
        return false;

    }
    if(check_message.value=="")
    {
        alert ( "Please Enter Your Message  " );

        check_message.focus();
        return false;
    }
    if (errorcheck(check_message.value)==false)
    {
        alert("Invalid Character \" ");
        check_message.focus();
        return false;
    }
    return true;
}

function  validate_form2()
{
    var  check_Country =document.application2.country;
    var check_State =document.application2.city;
    //var check_Country=document.application2.elements["countrySelect"];
    //var check_city=document.application2.stateSelect;
    var check_Address1=document.application2.address1;
    var check_Address2=document.application2.address2;
    var check_zip=document.application2.code;
    var check_phone=document.application2.phone;
    var check_mobile=document.application2.mobile;

    var alpha=/^[a-zA-Z]+$/;

    var numbers=/^[0-9]+$/;
    check_State.value=check_State.value.trim();
    check_Address1.value=check_Address1.value.trim();
    check_Address2.value=check_Address2.value.trim();
    check_zip.value=check_zip.value.trim();
    check_phone.value=check_phone.value.trim();
    check_mobile.value=check_mobile.value.trim();
    if (check_Country.value=="none")
    {
        alert ( "Please Choose Your Country" );
        return false;
    }

    if (check_State.length>1)
    {
        if (check_State.value=="-1")
        {
            alert ( "Please Enter Your city" );

            check_State.focus();
            return false;
        }
    }

    if (errorcheck(check_State.value)==false)
    {
        alert("Invalid Character \" ");
        check_State.focus();
        return false;
    }

    if (check_State.value.length>45)
    {
        alert("State Name is too long");
        check_State.focus();
        return false;
    }


    if (check_Address1.value=="")
    {
        alert ( "Please Enter Your Address" );
        return false;
    }
    if (errorcheck(check_Address1.value)==false)
    {
        alert("Invalid Character \" ");
        check_Address1.focus();
        return false;
    }

    if (check_Address1.value.length>500)
    {
        alert ( "The Address is too long" );
        return false;
    }
    if (check_Address2.value.length>500)
    {
        alert ( "Please enter your Address2 correctly" );
        return false;
    }
    if (errorcheck(check_Address2.value)==false)
    {
        alert("Invalid Character \" ");
        check_Address2.focus();
        return false;
    }




    if (check_zip.value!="")
    {

        if(!check_zip.value.match(numbers))
        {
            alert ( "Invalid zip code" );

            check_zip.focus();
            return false;
        }

        if(check_zip.value.length>20)
        {
            alert ("Invalid Zip Code" );
            check_zip.focus();
            return false;
        }
    }

    if ( check_phone.value=="")
    {
        alert ( "Please Enter Your Phone Number " );
        return false;
    }
    if (!check_phone.value.match(numbers))
    {
        alert ( "Invalid Phone Number " );
        return false;
    }
    if(check_phone.value.length>20)
    {
        alert("Phone Number is too long")
        return false;
    }
    if ( check_mobile.value=="")
    {
        alert ( "Please Enter Your Mobile " );
        return false;
    }
    if (!check_mobile.value.match(numbers))
    {
        alert ( "Invalid Mobile Number" );
        return false;
    }
    if(check_mobile.value.length>20)
    {
        alert ( "Mobile Number is too long" );
        return false;
    }
    return true;
}

function validate_form3()
{

    if(document.all)
    {

        var check_Education=document.all.application3.Education_level;
        var check_Institue=document.all.application3.elements["institute_name"];
        var check_FieldOfStudy=document.all.application3.elements["study"];
        var check_Career=document.all.application3.elements["career"];
        var check_OtherField=document.all.application3.elements["otherField"];
        var check_Grade=document.all.application3.elements["grade"];
        var check_GraduationYear=document.all.application3.elements["gDate"];

        var check_Experience=document.all.application3.Experience1;

        var check_Company1=document.all.application3.company1;
        var check_Company2=document.all.application3.company2;
        var check_Company3=document.all.application3.company3;
        var check_Position1=document.all.application3.position1;
        var check_Position2=document.all.application3.position2;
        var check_Position3=document.all.application3.position3;
        var check_From1=document.all.application3.from1;
        var check_From2=document.all.application3.from2;
        var check_From3=document.all.application3.from3;
        var check_To1=document.all.application3.to1;
        var check_To2=document.all.application3.to2;
        var check_To3=document.all.application3.to3;
    }
    else
    {
        var check_Education=document.application3.Education_level;
        var check_Institue=document.application3.elements["institute_name"];
        var check_FieldOfStudy=document.application3.elements["study"];
        var check_Career=document.application3.elements["career"];
        var check_OtherField=document.application3.elements["otherField"];
        var check_Grade=document.application3.elements["grade"];
        var check_GraduationYear=document.application3.elements["gDate"];
        var check_Experience=document.application3.Experience1;

        var check_Company1=document.application3.company1;
        var check_Company2=document.application3.company2;
        var check_Company3=document.application3.company3;
        var check_Position1=document.application3.position1;
        var check_Position2=document.application3.position2;
        var check_Position3=document.application3.position3;
        var check_From1=document.application3.from1;
        var check_From2=document.application3.from2;
        var check_From3=document.application3.from3;
        var check_To1=document.application3.to1;
        var check_To2=document.application3.to2;
        var check_To3=document.application3.to3;

    }
    var date=/^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d$/;

    check_Company1.value=check_Company1.value.trim();

    check_Company2.value=check_Company2.value.trim();

    check_Company3.value=check_Company3.value.trim();

    check_Position1.value=check_Position1.value.trim();
    check_Position2.value=check_Position2.value.trim();
    check_Position3.value=check_Position3.value.trim();

    if (check_Education.value=="-1")
    {
        alert ( "Please Select Your Education Level " );
        return false;
    }

    if ( check_Institue.value=="-1")
    {
        alert ( "Please Specify Your Institute/University " );
        return false;
    }
    if ( check_Grade.value=="-1")
    {
        alert ( "Please Select Your Grade " );
        return false;
    }
    if ( check_GraduationYear.value=="-1")
    {
        alert ( "Please Select Your Graduation Year " );
        return false;
    }

    if ( check_FieldOfStudy.value=="Please select one")
    {
        alert ( "Please Select your Study Field" );
        return false;
    }
    if ( check_FieldOfStudy.value=="Other")
    {
        if(check_OtherField.value=="")
        {
            alert ( "Please Enter Your Study field " );
            check_OtherField.focus();
            return false;
        }
    }
    if(check_Experience.value!="0")
    {
        if (check_Company1.value=="")
        {
            alert ( "Please Specify your Company number 1" );
            return false;
        }
        if (errorcheck(check_Company1.value)==false)
        {
            alert("Invalid Character \" ");
            check_Company1.focus();
            return false;
        }

        if (check_Company1.value.length>100)
        {
            alert ( "Please Specify your Company number 1 correctly" );
            return false;
        }
        if (check_Position1.value=="")
        {
            alert ( "Please Specify your Position in company number 1" );
            return false;
        }
        if (errorcheck(check_Position1.value)==false)
        {
            alert("Invalid Character \" ");
            check_Position1.focus();
            return false;
        }

        if (check_Position1.value.length>100)
        {
            alert ( "Please Specify your Position in company number 1 correctly" );
            return false;
        }
        if (check_From1.value==""||!check_From1.value.match(date))
        {
            alert ( "Please Specify From date using calender in company number 1" );
            return false;
        }
        if (check_To1.value!=""&&!check_To1.value.match(date))
        {
            alert ( "Please Specify To date using calender in company number 1" );
            return false;
        }
    }

    if (check_Company2.value!="")
    {

        if (errorcheck(check_Company2.value)==false)
        {
            alert("Invalid Character \" ");
            check_Company2.focus();
            return false;
        }
        else if (check_Company2.value.length>100)
        {
            alert ( "Please Specify your Company number 2 correctly" );
            return false;
        }
        else if (check_Position2.value=="")
        {
            alert ( "Please Specify your Position in company number 2" );
            return false;
        }
        else if (errorcheck(check_Position2.value)==false)
        {
            alert("Invalid Character \" ");
            check_Position2.focus();
            return false;
        }

        else  if (check_Position2.value.length>100)
        {
            alert ( "Please Specify your Position in company number 2 correctly" );
            return false;
        }

        else  if (check_From2.value==""||!check_From2.value.match(date))
        {
            alert ( "Please Specify From date using calender in company number 2" );
            return false;
        }
        else  if (check_To2.value!=""&&!check_To2.value.match(date))
        {
            alert ( "Please Specify To date using calender in company number 2" );
            return false;
        }
    }

    else  if (check_Company3.value!="")
    {
        if (check_Company3.value.length>100)
        {
            alert ( "Please Specify your Company number 3 correctly" );
            return false;
        }

        else if (errorcheck(check_Company3.value)==false)
        {
            alert("Invalid Character \" ");
            check_Company3.focus();
            return false;
        }

        if (check_Position3.value=="")
        {
            alert ( "Please Specify your Position in company number 3" );
            return false;
        }
        else if (errorcheck(check_Position3.value)==false)
        {
            alert("Invalid Character \" ");
            check_Position3.focus();
            return false;
        }
        else  if (check_Position3.value.length>100)
        {
            alert ( "Please Specify your Position in company number 3 correctly" );
            return false;
        }

        else  if (check_From3.value==""||!check_From3.value.match(date))
        {
            alert ( "Please Specify From date using calender in company number 3" );
            return false;
        }
        else  if (check_To3.value!=""&&!check_To3.value.match(date))
        {
            alert ( "Please Specify To date using calender in company number 3" );
            return false;
        }
    }
    if ( check_Career.value=="Please select one")
    {
        alert ( "Please Select Your Career " );
        return false;
    }
    return true;
}

function  validate_form4()
{
    if(document.all)
    {
        var check_salary=document.all.application4.salary1;
        var check_cv=document.all.application4.cv;
    }
    else
    {
        var check_salary=document.application4.salary1;
        var check_cv=document.application4.cv;
    }
    var alpha=/^[a-zA-Z]+$/;
    var numbers=/^[0-9]+$/;
    check_salary.value=check_salary.value.trim();
    if(check_salary.value=="")
    {
        alert ( "Please Enter Expected Salary" );
        return false;
    }
    if (!check_salary.value.match(numbers))
    {
        alert ( "Please enter Expected Salary correctly " );
        return false;
    }
    if(check_salary.value>100000)
    {
        alert ( "The Expected Salary is too large" );
        return false;
    }

    if(check_cv.value=="")
    {
        alert ( "Please upload your CV" );
        return false;
    }
    return true;
}

function  validate_suppliers()
{
    var check_fullname =document.supplierform.Text1;
    var check_short =document.supplierform.Text2;
    var check_address =document.supplierform.TextArea5;
    var check_Country =document.supplierform.country;
    var check_City =document.supplierform.city;
    var check_phone =document.supplierform.Text3;
    var check_fax =document.supplierform.Text4;
    var check_Email=document.supplierform.Text5;
    var check_ContactPerson =document.supplierform.Text6;
    var check_b_name =document.supplierform.Text7;
    var check_preQ =document.supplierform.preQ;
    var check_office_name =document.supplierform.Text9;
    var check_office_phone =document.supplierform.Text10;
    var check_office_fax =document.supplierform.Text11;
    var check_office_email =document.supplierform.Text12;
    var check_office_persone =document.supplierform.Text13;
    var check_field =document.supplierform.elements["field"];
    var comment=document.supplierform.TextArea4;
    var alpha=/^[a-zA-Z\s]*$/;
    var numbers=/^[0-9]+$/;

    check_fullname.value=check_fullname.value.trim();
    check_short.value=check_short.value.trim();
    check_address.value=check_address.value.trim();
    check_phone.value=check_phone.value.trim();
    check_fax.value=check_fax.value.trim();
    check_Email.value=check_Email.value.trim();
    check_ContactPerson.value=check_ContactPerson.value.trim();
    check_b_name.value=check_b_name.value.trim();
    check_preQ.value=check_preQ.value.trim();
    check_office_name.value=check_office_name.value.trim();
    check_office_phone.value=check_office_phone.value.trim();
    check_office_fax.value=check_office_fax.value.trim();
    check_office_email.value=check_office_email.value.trim();
    check_office_persone.value=check_office_persone.value.trim();
    comment.value=comment.value.trim();

    if (check_fullname.value=="")

    {

        alert ( "Please Enter Your Name" );

        check_fullname.focus();
        return false;
    }
    if (errorcheck(check_fullname.value)==false)
    {
        alert("Invalid Character \" ");
        check_fullname.focus();
        return false;
    }

    if(check_fullname.value.length>45)
    {
        alert ( "Supplier Name is too Long" );

        check_fullname.focus();
        return false;

    }


    if (errorcheck(check_short.value)==false)
    {
        alert("Invalid Character \" ");
        check_short.focus();
        return false;
    }


    if( check_short.value.length>20)
    {
        alert ( "Short Name Couldn't be more than 20 Character  " );

        check_short.focus();
        return false;

    }


    if (check_address.value=="")
    {
        alert ( "Please enter your address" );


        check_address.focus();
        return false;
    }
    if (errorcheck(check_address.value)==false)
    {
        alert("Invalid Character \" ");
        check_address.focus();
        return false;
    }


    if( check_address.value.length>1000)
    {
        alert ( "The Address is too Long" );

        check_address.focus();
        return false;

    }

    if(check_Country.value=="none")
    {
        alert ("please select country" );

        check_City.focus();
        return false;
    }

    if(check_City.value=="-1")
    {
        alert ("please select city" );

        check_City.focus();
        return false;
    }


    if (check_phone.value=="")
    {
        alert ( "Please Enter Telephone Number" );

        check_phone.focus();
        return false;
    }

    if(!check_phone.value.match(numbers))
    {
        alert ( "Invalid Telephone Number" );
        check_phone.focus();
        return false;
    }
    if(check_phone.value.length>20)
    {
        alert ("telephone Number is too long" );
        check_phone.focus();
        return false;
    }


    if (check_fax.value!=""&&!check_fax.value.match(numbers))
    {
        alert ( "Invalid Fax Number" );
        check_fax.focus();
        return false;

    }
    if(check_fax.value.length>20)
    {
        alert ( "Fax Number is too Long" );
        check_fax.focus();
        return false;

    }


    if(check_Email.value=="")
    {
        alert ( "Please Enter Your E-mail" );
        check_Email.focus();
        return false;

    }
    if (errorcheck(check_Email.value)==false)
    {
        alert("Invalid Character \" ");
        check_Email.focus();
        return false;
    }


    if (echeck(check_Email.value)==false)
    {
        check_Email.focus();
        return false;
    }
    if(check_Email.value.length>100)
    {
        alert ( "E-mail is too Long" );
        check_Email.focus();
        return false;

    }

    if (check_ContactPerson.value=="")
    {
        alert ( "Please Enter Contact Person Name" );
        check_ContactPerson.focus();
        return false;

    }

    if (errorcheck(check_ContactPerson.value)==false)
    {
        alert("Invalid Character \" ");
        check_ContactPerson.focus();
        return false;
    }

    if(check_ContactPerson.value.length>45)
    {
        alert ( "Contact Person Name is too Long" );

        check_ContactPerson.focus();
        return false;

    }

    if (errorcheck(check_b_name.value)==false)
    {
        alert("Invalid Character \" ");
        check_b_name.focus();
        return false;
    }

    if (check_b_name.value.length>45)
    {
        alert ( "Bank Name is too long" );
        check_b_name.focus();
        return false;
    }

    if (errorcheck(check_office_name.value)==false)
    {
        alert("Invalid Character \" ");
        check_office_name.focus();
        return false;
    }

    if (check_office_name.value.length>45)
    {
        alert ( "Office Name is too Long" );

        check_office_name.focus();
        return false;
    }

    if (check_office_phone.value!=""&&!check_office_phone.value.match(numbers))
    {
        alert ( "Invalid Phone Number" );
        check_office_phone.focus();
        return false;
    }
    if (check_office_phone.value.length>20)

    {
        alert ( "Phone Number is too Long" );
        check_office_phone.focus();
        return false;
    }

    if (check_office_fax.value!=""&&!check_office_fax.value.match(numbers))
    {
        alert ( "Invalid Fax Number" );


        check_office_fax.focus();
        return false;
    }
    if(check_office_fax.value.length>45)
    {
        alert ( "Fax Number is too Long" );
        check_office_fax.focus();
        return false;
    }

    if (check_office_email.value!=""&&echeck(check_office_email.value)==false)
    {
        check_office_email.focus();
        return false;
    }
    if (errorcheck(check_office_email.value)==false)
    {
        alert("Invalid Character \" ");
        check_office_email.focus();
        return false;
    }


    if(check_office_email.value.length>100)
    {
        alert ( "E-mail is too Long" );
        check_office_email.focus();
        return false;

    }

    if (errorcheck(check_office_persone.value)==false)
    {
        alert("Invalid Character \" ");
        check_office_persone.focus();
        return false;
    }

    if(check_office_persone.value.length>45)
    {
        alert ( "Contact Persone Name is too long" );

        check_office_persone.focus();
        return false;

    }

    /*if (check_field.value=="")
    {
    alert ( "Please Select at least One Field" );


    check_field.focus();
    return false;
    }*/
    if (errorcheck(comment.value)==false)
    {
        alert("Invalid Character \" ");
        comment.focus();
        return false;
    }

    else if(check_preQ.value=="")
    {
        alert ( "Please Upload Your Pre Qualification" );
        return false;
    }



    return true;
}

function validate_update_application()
{
    if(document.all)
    {
        var check_gender =document.all.Update_application.elements["Gender"];
        var check_first =document.all.Update_application.F_name;
        var check_middle =document.all.Update_application.M_name;
        var check_last =document.all.Update_application.L_name;
        var check_date =document.all.Update_application.Birth;
        var check_nationality =document.all.Update_application.Nationality;
        var check_national_id=document.all.Update_application.ssn;
        var check_marital =document.all.Update_application.elements["marital"];
        var check_military=document.all.Update_application.elements["military"];
        var check_children=document.all.Update_application.elements["children"];
        var check_country=document.all.Update_application.country;
        var check_city=document.all.Update_application.city;
        var check_address1=document.all.Update_application.address1;
        var check_address2=document.all.Update_application.address2;
        var check_zip=document.all.Update_application.code;
        var check_phone=document.all.Update_application.phone;
        var check_mobile=document.all.Update_application.mobile;
        var check_FieldOfStudy=document.all.Update_application.elements["study"];
        var check_OtherField=document.all.Update_application.elements["otherField"];
        var check_Experience=document.all.Update_application.Experience1;
        var check_company1=document.all.Update_application.company1;
        var check_company2=document.all.Update_application.company2;
        var check_company3=document.all.Update_application.company3;
        var check_position1=document.all.Update_application.position1;
        var check_position2=document.all.Update_application.position2;
        var check_position3=document.all.Update_application.position3;
        var check_from1=document.all.Update_application.from1;
        var check_from2=document.all.Update_application.from2;
        var check_from3=document.all.Update_application.from3;
        var check_to1=document.all.Update_application.to1;
        var check_to2=document.all.Update_application.to2;
        var check_to3=document.all.Update_application.to3;
        var check_salary=document.all.Update_application.salary1;
        var check_cv=document.all.Update_application.cv;


    }
    else
    {
        var check_gender =document.Update_application.elements["Gender"];
        var check_first =document.Update_application.F_name;
        var check_middle =document.Update_application.M_name;
        var check_last=document.Update_application.L_name;
        var check_date =document.Update_application.Birth;
        var check_nationality =document.Update_application.Nationality;
        var check_military=document.Update_application.elements["military"];
        var check_national_id=document.Update_application.ssn;
        var check_marital =document.Update_application.elements["marital"];
        var check_children=document.Update_application.elements["children"];
        var check_country=document.Update_application.country;
        var check_city=document.Update_application.city;
        var check_address1=document.Update_application.address1;
        var check_address2=document.Update_application.address2;
        var check_zip=document.Update_application.code;
        var check_phone=document.Update_application.phone;
        var check_mobile=document.Update_application.mobile;
        var check_FieldOfStudy=document.Update_application.elements["study"];
        var check_OtherField=document.Update_application.elements["otherField"];
        var check_Experience=document.Update_application.Experience1;
        var check_company1=document.Update_application.company1;
        var check_company2=document.Update_application.company2;
        var check_company3=document.Update_application.company3;
        var check_position1=document.Update_application.position1;
        var check_position2=document.Update_application.position2;
        var check_position3=document.Update_application.position3;
        var check_from1=document.Update_application.from1;
        var check_from2=document.Update_application.from2;
        var check_from3=document.Update_application.from3;
        var check_to1=document.Update_application.to1;
        var check_to2=document.Update_application.to2;
        var check_to3=document.Update_application.to3;
        var check_salary=document.Update_application.salary1;
        var check_cv=document.Update_application.cv;

    }


    var alpha=/^[a-zA-Z]+$/;
    var numbers=/^[0-9]+$/;
    var date=/^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d$/;
    check_first.value=check_first.value.trim();
    check_middle.value=check_middle.value.trim();
    check_last.value=check_last.value.trim();
    check_national_id.value=check_national_id.value.trim();
    check_city.value=check_city.value.trim();
    check_address1.value=check_address1.value.trim();
    check_address2.value=check_address2.value.trim();
    check_zip.value=check_zip.value.trim();
    check_phone.value=check_phone.value.trim();
    check_mobile.value=check_mobile.value.trim();
    check_company1.value=check_company1.value.trim();
    check_company2.value=check_company2.value.trim();
    check_company3.value=check_company3.value.trim();
    check_position1.value=check_position1.value.trim();
    check_position2.value=check_position2.value.trim();
    check_position3.value=check_position3.value.trim();
    check_salary.value=check_salary.value.trim();


    //personal detailes validation....................

    if (check_first.value=="")
    {
        alert ( "Please Enter Your First Name " );
        check_first.focus();
        return false;
    }
    if (!check_first.value.match(alpha))
    {
        alert ( "Please Enter Correct Name" );
        check_first.focus();
        return false;
    }
    if (errorcheck(check_first.value)==false)
    {
        alert("Invalid Character \" ");
        check_first.focus();
        return false;
    }
    if (check_first.value.length>45)
    {
        alert("Name is too long");
        check_first.focus();
        return false;
    }
    if (check_middle.value=="")
    {
        alert ( "Please Enter Your Middle Name " );
        check_middle.focus();
        return false;
    }
    if (!check_middle.value.match(alpha))
    {
        alert ( "Please Enter Correct Name" );
        check_middle.focus();
        return false;
    }
    if (errorcheck(check_middle.value)==false)
    {
        alert("Invalid Character \" ");
        check_middle.focus();
        return false;
    }
    if (check_middle.value.length>45)
    {
        alert("Name is too long");
        check_middle.focus();
        return false;
    }
    if (check_last.value=="")
    {
        alert ( "Please Enter Your Last Name " );
        check_last.focus();
        return false;
    }
    if (!check_last.value.match(alpha))
    {
        alert ( "Please Enter Correct Name" );
        check_last.focus();
        return false;
    }
    if (errorcheck(check_last.value)==false)
    {
        alert("Invalid Character \" ");
        check_last.focus();
        return false;
    }
    if (check_last.value.length>45)
    {
        alert("Name is too long");
        check_last.focus();
        return false;
    }
    if (check_date.value=="")
    {
        alert ( "Please Enter Your Birth Date " );
        return false;
    }
    if (!check_date.value.match(date))
    {
        alert ( "Please Enter Your Birth Date Correctly" );
        return false;
    }
    if(check_nationality.options[check_nationality.selectedIndex].value=='Egypt' && check_gender.options[check_gender.selectedIndex].value=='Male')
    {
        if(check_military.value=="-1")
        {
            alert ( "Please specify your Military Status" );
            return false;
        }
    }

    if(check_nationality.options[check_nationality.selectedIndex].value=='Egypt')
    {
        if(check_national_id.value=="")
        {
            alert ( "Please Enter Your National ID Number " );
            check_national_id.focus();
            return false;

        }
        if(! check_national_id.value.match(numbers))
        {
            alert ( "Invalid ID Number" );
            check_national_id.focus();
            return false;
        }
        if (errorcheck(check_national_id.value)==false)
        {
            alert("Invalid Character \" ");
            check_national_id.focus();
            return false;
        }
        if (check_national_id.value.length>14)
        {
            alert("Too Long Number");
            check_national_id.focus();
            return false;
        }
    }
    if(check_marital.value=="-1")
    {
        alert ( "Please enter your Marital Status" );
        return false;
    }



    //contact detailes validation............

    if (check_city.length>1)
    {
        if (check_city.value=="-1")
        {
            alert ( "Please Enter Your City" );
            check_city.focus();
            return false;
        }
    }

    if (errorcheck(check_city.value)==false)
    {
        alert("Invalid Character \" ");
        check_city.focus();
        return false;
    }
    if (check_city.value.length>45)
    {
        alert("State Name is too long");
        check_city.focus();
        return false;
    }
    if (check_address1.value=="")
    {
        alert ( "Please Enter Your Address" );
        return false;
    }
    if (errorcheck(check_address1.value)==false)
    {
        alert("Invalid Character \" ");
        check_address1.focus();
        return false;
    }
    if (check_address1.value.length>500)
    {
        alert ( "The Address is too long" );
        return false;
    }
    if (check_address2.value.length>500)
    {
        alert ( "Please enter your Address2 correctly" );
        return false;
    }
    if (errorcheck(check_address2.value)==false)
    {
        alert("Invalid Character \" ");
        check_address2.focus();
        return false;
    }
    if (check_zip.value!="")
    {
        if(!check_zip.value.match(numbers))
        {
            alert ( "Invalid zip code" );
            check_zip.focus();
            return false;
        }
        if(check_zip.value.length>20)
        {
            alert ("Invalid Zip Code" );
            check_zip.focus();
            return false;
        }
    }
    if ( check_phone.value=="")
    {
        alert ( "Please Enter Your Phone Number " );
        return false;
    }
    if (!check_phone.value.match(numbers))
    {
        alert ( "Invalid Phone Number " );
        return false;
    }
    if(check_phone.value.length>20)
    {
        alert("Phone Number is too long")
        return false;
    }
    if ( check_mobile.value=="")
    {
        alert ( "Please Enter Your Mobile " );
        return false;
    }
    if (!check_mobile.value.match(numbers))
    {
        alert ( "Invalid Mobile Number" );
        return false;
    }
    if(check_mobile.value.length>20)
    {
        alert ( "Mobile Number is too long" );
        return false;
    }


    //Education information validation.................

    if ( check_FieldOfStudy.value=="-1")
    {
        alert ( "Please Select your Study Field" );
        return false;
    }
    if ( check_FieldOfStudy.value=="Other")
    {
        if(check_OtherField.value=="")
        {
            alert ( "Please Enter Your Study field " );
            check_OtherField.focus();
            return false;
        }
    }
    if(check_Experience.value!="0")
    {
        if (check_company1.value=="")
        {
            alert ( "Please Specify your Company number 1" );
            return false;
        }
        if (errorcheck(check_company1.value)==false)
        {
            alert("Invalid Character \" ");
            check_company1.focus();
            return false;
        }

        if (check_company1.value.length>100)
        {
            alert ( "Please Specify your Company number 1 correctly" );
            return false;
        }
        if (check_position1.value=="")
        {
            alert ( "Please Specify your Position in company number 1" );
            return false;
        }
        if (errorcheck(check_position1.value)==false)
        {
            alert("Invalid Character \" ");
            check_position1.focus();
            return false;
        }

        if (check_position1.value.length>100)
        {
            alert ( "Please Specify your Position in company number 1 correctly" );
            return false;
        }
        if (check_from1.value==""||!check_from1.value.match(date))
        {
            alert ( "Please Specify From date using calender in company number 1" );
            return false;
        }
        if (check_to1.value!=""&&!check_to1.value.match(date))
        {
            alert ( "Please Specify To date using calender in company number 1" );
            return false;
        }
    }

    if (check_company2.value!="")
    {

        if (errorcheck(check_company2.value)==false)
        {
            alert("Invalid Character \" ");
            check_company2.focus();
            return false;
        }
        else if (check_company2.value.length>100)
        {
            alert ( "Please Specify your Company number 2 correctly" );
            return false;
        }
        else if (check_position2.value=="")
        {
            alert ( "Please Specify your Position in company number 2" );
            return false;
        }
        else if (errorcheck(check_position2.value)==false)
        {
            alert("Invalid Character \" ");
            check_position2.focus();
            return false;
        }

        else  if (check_position2.value.length>100)
        {
            alert ( "Please Specify your Position in company number 2 correctly" );
            return false;
        }

        else  if (check_from2.value==""||!check_from2.value.match(date))
        {
            alert ( "Please Specify From date using calender in company number 2" );
            return false;
        }
        else  if (check_to2.value!=""&&!check_to2.value.match(date))
        {
            alert ( "Please Specify To date using calender in company number 2" );
            return false;
        }
    }

    else  if (check_company3.value!="")
    {
        if (check_company3.value.length>100)
        {
            alert ( "Please Specify your Company number 3 correctly" );
            return false;
        }

        else if (errorcheck(check_company3.value)==false)
        {
            alert("Invalid Character \" ");
            check_company3.focus();
            return false;
        }

        if (check_position3.value=="")
        {
            alert ( "Please Specify your Position in company number 3" );
            return false;
        }
        else if (errorcheck(check_position3.value)==false)
        {
            alert("Invalid Character \" ");
            check_position3.focus();
            return false;
        }
        else  if (check_position3.value.length>100)
        {
            alert ( "Please Specify your Position in company number 3 correctly" );
            return false;
        }

        else  if (check_from3.value==""||!check_from3.value.match(date))
        {
            alert ( "Please Specify From date using calender in company number 3" );
            return false;
        }
        else  if (check_to3.value!=""&&!check_to3.value.match(date))
        {
            alert ( "Please Specify To date using calender in company number 3" );
            return false;
        }
    }

    //Experince informayion.................
    if(check_salary.value=="")
    {
        alert ( "Please Enter Expected Salary" );
        return false;
    }
    if (!check_salary.value.match(numbers))
    {
        alert ( "Please enter Expected Salary correctly " );
        return false;
    }
    if(check_salary.value>100000)
    {
        alert ( "The Expected Salary is too large" );
        return false;
    }

    if(check_cv.value=="")
    {
        alert ( "Please upload your CV" );
        return false;
    }
    return true;
}

function validate_update_supplier()
{
    var check_fullname =document.supplierform.Text1;
    var check_short =document.supplierform.Text2;
    var check_address =document.supplierform.TextArea1;

    var check_City =document.supplierform.state;
    var check_phone =document.supplierform.Text3;
    var check_fax =document.supplierform.Text4;
    var check_Email=document.supplierform.Text5;
    var check_ContactPerson =document.supplierform.Text6;
    var check_b_name =document.supplierform.Text7;
    var check_preQ =document.supplierform.cv;
    var check_office_name =document.supplierform.Text9;
    var check_office_phone =document.supplierform.Text10;
    var check_office_fax =document.supplierform.Text11;
    var check_office_email =document.supplierform.Text12;
    var check_office_persone =document.supplierform.Text13;
    var check_field =document.supplierform.elements["field"];
    var comment=document.supplierform.TextArea4;

    var alpha=/^[a-zA-Z\s]*$/;
    var numbers=/^[0-9]+$/;

    check_fullname.value=check_fullname.value.trim();

    check_short.value=check_short.value.trim();

    check_address.value=check_address.value.trim();

    check_phone.value=check_phone.value.trim();

    check_fax.value=check_fax.value.trim();

    check_Email.value=check_Email.value.trim();

    check_ContactPerson.value=check_ContactPerson.value.trim();

    check_b_name.value=check_b_name.value.trim();

    check_preQ.value=check_preQ.value.trim();

    check_office_name.value=check_office_name.value.trim();

    check_office_phone.value=check_office_phone.value.trim();
    check_office_fax.value=check_office_fax.value.trim();
    check_office_email.value=check_office_email.value.trim();
    check_office_persone.value=check_office_persone.value.trim();
    comment.value=comment.value.trim();

    if (check_fullname.value=="")

    {

        alert ( "Please Enter Your Name" );

        check_fullname.focus();
        return false;
    }
    if (errorcheck(check_fullname.value)==false)
    {
        alert("Invalid Character \" ");
        check_fullname.focus();
        return false;
    }

    if(check_fullname.value.length>45)
    {
        alert ( "Supplier Name is too Long" );

        check_fullname.focus();
        return false;

    }


    if (errorcheck(check_short.value)==false)
    {
        alert("Invalid Character \" ");
        check_short.focus();
        return false;
    }


    if( check_short.value.length>20)
    {
        alert ( "Short Name Couldn't be more than 20 Character  " );

        check_short.focus();
        return false;

    }


    if (check_address.value=="")
    {
        alert ( "Please enter your address" );


        check_address.focus();
        return false;
    }
    if (errorcheck(check_address.value)==false)
    {
        alert("Invalid Character \" ");
        check_address.focus();
        return false;
    }


    if( check_address.value.length>1000)
    {
        alert ( "The Address is too Long" );

        check_address.focus();
        return false;

    }



    if(check_City.value=="Select State")
    {
        alert ("please select state" );

        check_City.focus();
        return false;
    }


    if (check_phone.value=="")
    {
        alert ( "Please Enter Telephone Number" );

        check_phone.focus();
        return false;
    }

    if(!check_phone.value.match(numbers))
    {
        alert ( "Invalid Telephone Number" );
        check_phone.focus();
        return false;
    }
    if(check_phone.value.length>20)
    {
        alert ("telephone Number is too long" );
        check_phone.focus();
        return false;
    }


    if (check_fax.value!=""&&!check_fax.value.match(numbers))
    {
        alert ( "Invalid Fax Number" );
        check_fax.focus();
        return false;

    }
    if(check_fax.value.length>20)
    {
        alert ( "Fax Number is too Long" );
        check_fax.focus();
        return false;

    }


    if(check_Email.value=="")
    {
        alert ( "Please Enter Your E-mail" );
        check_Email.focus();
        return false;

    }
    if (errorcheck(check_Email.value)==false)
    {
        alert("Invalid Character \" ");
        check_Email.focus();
        return false;
    }


    if (echeck(check_Email.value)==false)
    {
        check_Email.focus();
        return false;
    }
    if(check_Email.value.length>100)
    {
        alert ( "E-mail is too Long" );
        check_Email.focus();
        return false;

    }

    if (check_ContactPerson.value=="")
    {
        alert ( "Please Enter Contact Person Name" );
        check_ContactPerson.focus();
        return false;

    }

    if (errorcheck(check_ContactPerson.value)==false)
    {
        alert("Invalid Character \" ");
        check_ContactPerson.focus();
        return false;
    }

    if(check_ContactPerson.value.length>45)
    {
        alert ( "Contact Person Name is too Long" );

        check_ContactPerson.focus();
        return false;

    }

    if (errorcheck(check_b_name.value)==false)
    {
        alert("Invalid Character \" ");
        check_b_name.focus();
        return false;
    }

    if (check_b_name.value.length>45)
    {
        alert ( "Bank Name is too long" );
        check_b_name.focus();
        return false;
    }

    if (errorcheck(check_office_name.value)==false)
    {
        alert("Invalid Character \" ");
        check_office_name.focus();
        return false;
    }

    if (check_office_name.value.length>45)
    {
        alert ( "Office Name is too Long" );

        check_office_name.focus();
        return false;
    }

    if (check_office_phone.value!=""&&!check_office_phone.value.match(numbers))
    {
        alert ( "Invalid Phone Number" );
        check_office_phone.focus();
        return false;
    }
    if (check_office_phone.value.length>20)

    {
        alert ( "Phone Number is too Long" );
        check_office_phone.focus();
        return false;
    }

    if (check_office_fax.value!=""&&!check_office_fax.value.match(numbers))
    {
        alert ( "Invalid Fax Number" );


        check_office_fax.focus();
        return false;
    }
    if(check_office_fax.value.length>45)
    {
        alert ( "Fax Number is too Long" );
        check_office_fax.focus();
        return false;
    }

    if (check_office_email.value!=""&&echeck(check_office_email.value)==false)
    {
        check_office_email.focus();
        return false;
    }
    if (errorcheck(check_office_email.value)==false)
    {
        alert("Invalid Character \" ");
        check_office_email.focus();
        return false;
    }


    if(check_office_email.value.length>100)
    {
        alert ( "E-mail is too Long" );
        check_office_email.focus();
        return false;

    }

    if (errorcheck(check_office_persone.value)==false)
    {
        alert("Invalid Character \" ");
        check_office_persone.focus();
        return false;
    }

    if(check_office_persone.value.length>45)
    {
        alert ( "Contact Persone Name is too long" );

        check_office_persone.focus();
        return false;

    }

    /*if (check_field.value=="")
    {
    alert ( "Please Select at least One Field" );


    check_field.focus();
    return false;
    }*/

    if (errorcheck(comment.value)==false)
    {
        alert("Invalid Character \" ");
        comment.focus();
        return false;
    }

    else if(check_preQ.value=="")
    {
        alert ( "Please Upload Your Pre Qualification" );
        return false;
    }



    return true;
}

function setMenuCellHeight(radio)
{
    document.getElementById('menuCell').height=document.getElementById('innerPageCell').height;

}
